import axios from 'axios'
import utilsFunc from '../api/utilsFunc';
// const basicUrl = "http://47.107.147.145:8080/";
const talentList = `${utilsFunc.baseurl}agency/list`
console.log(utilsFunc.baseurl);
debugger;
const getTalentList = (params, dispatch) => {
    return async (dispatch) => getList(params, dispatch);
}
const GETLIST = "GET_LIST";
function getList(params, dispatch) {
    let paramsStr = '';
    for (var key in params) {
        var value = params[key]
        paramsStr = paramsStr + `${key}=${value}&`
    }
    paramsStr = paramsStr.slice(0, paramsStr.length - 1);
    const listParams = `${talentList}?${paramsStr}`
    axios.get(listParams).then(res => {
        dispatch(getListAction(GETLIST, res.data.data))
    })
}
function getListAction(GETLIST, talentListparams) {
    return {
        type: GETLIST,
        talentListparams: talentListparams
    }
}

export const mapStateToProps = (state) => {
    return {
        Agencylist: state.Agencylist,
    }
}
export const mapDispatchToProps = (dispatch) => {
    return {
        getTalent: (params) => {
            dispatch(getTalentList(params, dispatch));
        }
    };
}